package com.heima.wemedia.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.model.common.dtos.PageRequestDto;
import com.heima.model.common.dtos.PageSensitive;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmSensitiveDto;
import com.heima.model.wemedia.pojos.WmSensitive;
import com.heima.wemedia.mapper.WmSensitiveMapper;
import com.heima.wemedia.service.WmSensitiveService;

import org.springframework.stereotype.Service;


import java.util.ArrayList;
import java.util.List;

@Service
public class WmSensitiveServiceimp extends ServiceImpl<WmSensitiveMapper,WmSensitive> implements WmSensitiveService {

    @Override
    public ResponseResult Sensitiveslist(PageSensitive pageSensitive) {
        Page<WmSensitive> page = new Page<>(pageSensitive.getPage(), pageSensitive.getSize());
        LambdaQueryWrapper<WmSensitive> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.like(WmSensitive::getSensitives,pageSensitive.getName());
        Page<WmSensitive> wmSensitivePage = this.page(page,queryWrapper);
        List<WmSensitive> records = wmSensitivePage.getRecords();
        return ResponseResult.okResult(records);
    }
}
